
public class Board {
	protected PlayingField pf;
	protected Square[][] Squares;
	protected int level;
	
	public Board(int l) {
		level = l;
		Squares = new Square[12][8];
	}
	
	public PlayingField getPF() {
		return pf;
	}
	
	public void setPF(PlayingField pf) {
		this.pf = pf;
	}
	
	public int getLevel() {
		return level;
	}
	
	public Square getSquare(int c, int r) {
		return Squares[c][r];
	}
	
	public void addSquare(int c, int r) {
		Squares[c][r] = new Square(level, c, r);
		Squares[c][r].setPF(this.pf);
		Squares[c][r].setBoard(this);
	}
	
	public Piece getPiece(int c, int r) {
		return Squares[c][r].getPiece();
	}
	
	public void addPiece(int c, int r, Piece p) {
		Squares[c][r].addPiece(p);
	}
	
	public void removePiece(Square s) {
		if (!s.isValid()){
			throw new IllegalArgumentException("The square " + s + " is not valid!");
		}
		s.removePiece();
	}
	
	public void add(Piece p, Square s){
		s.addPiece(p);
	}
	
	/*public int getAdjacentLevel(int dir){
		if (dir == 1) {
			return level + 1;
		} else if (dir == -1){
			return level - 1;
		} else {
			return 0;
		}
	}*/
	
	public String toString() {
		if(level == 0) {
			return "UnderBoard";
		} else if(level == 1) {
			return "EarthBoard";
		} else if(level == 2) {
			return "SkyBoard";
		} else {
			return "This Board has no level!";
		}
	}
}
